package com.zzl.boot.bigevent.pojo;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.zzl.boot.bigevent.anno.State;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.groups.Default;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import java.awt.*;
import java.time.LocalDateTime;

@Data
public class article {
    @NotNull(groups = article.update.class)
    private Integer id;//主键ID
    @Pattern(regexp = "^\\S{1,20}$")
    @NotEmpty
    private String title;//文章标题
    @NotEmpty
    private String content;//文章内容
    @URL
    @Nullable
    private String coverImg;//封面图像
    @NotNull
    private Integer categoryId;
    @State
    @NotEmpty
    private String state;//发布状态 已发布|草稿
    private Integer userId;//创建人ID
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;//创建时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;//更新时间
    private Integer visitCount;
    //@Validated校验的分组
    public interface add extends Default {}
    public interface update extends Default {}
}

